<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="format-detection" content="telephone=no" />
		<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
		<title>完善资料</title>

		<script type="text/javascript" src="__PUBLIC__/index/js/jquery-1.8.1.js"></script>
		<link href="__PUBLIC__/index/css/css.css" type="text/css" rel="stylesheet">
		<link href="__PUBLIC__/index/css/perf.css" type="text/css" rel="stylesheet">
		<script type="text/javascript" src="__PUBLIC__/index/js/alert.js"></script>
		<!-- 引入微信的js -->
		<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
	</head>

	<body>
		<ul class="fomr">

			<li class="name">
				<label for="name">称呼</label>
				<input type="text" name="name" id="name" value="{$list.name}"  placeholder="请填写称呼"/>
			</li>
			<li class="sex">		
				<input type="radio" name="sex"  id="ms" value="2" <if condition="$list.sex eq 2">checked="checked"</if>  />
				<label for="ms">女士</label>	
				<input type="radio" name="sex"  id="man" value="1"  <if condition="$list.sex eq 1">checked="checked"</if>  />
				<label for="man">先生</label>
			</li>
			<li class="tel" >
				<label for="tel">手机号</label>
				<div class="link" link="{:U('Gj/update_phone')}"> <?php echo substr_replace($list['phone'], '****', 5, 4); ?></div>
			</li>
			<li class="email">
				<label for="email">邮箱</label>
				<input type="email" name="email" id="email" value="{$list.email}"  placeholder="请填写邮箱"/>
			</li>
			<li class="day">
				<label for="day">生日</label>
				<input type="text" name="day" id="day" value="{$list.birth}"  placeholder="请填写生日"/>
			</li>
			<li class="apt">
				<label for="apt" style="float: left;">小区</label>
				
				<span class="stext">{$plot.name}</span>
				<select name="apt"  id="apt" >
					 <volist name="apt" id="data">
						<option value="{$data.id}">{$data.name}</option>	
					</volist>
				</select>
				
			</li>
			<li class="fanghao">
				<label for="fanghao">房号</label>
				<input type="text" name="fanghao" id="fanghao" value="{$list.num}" placeholder="请填房号" />
			</li>
			<li class="pwd" >
				<label for="pwd">密码</label>
				<div class="link"  link="{:U('Forget/index')}"></div>
			</li>
			<li class="buttom">确认修改</li>
	
		</ul>

	</body>

</html>
<script type="text/javascript">
	// 去除微信右上角的点点点
	wx.config({
		debug: false,
		appId: "{$sign.appId}",
		timestamp: "{$sign.timestamp}",
		nonceStr: "{$sign.nonceStr}",
		signature: "{$sign.signature}",
		jsApiList: [
			'wx.hideOptionMenu',
		]
	});
	wx.checkJsApi({
		jsApiList: [
			'getLocation'
		],
		success: function(res) {

			if(res.checkResult.getLocation == false) {
				alert('你的微信版本太低，不支持微信JS接口，请升级到最新的微信版本！');
				return;
			}
		}
	});
	//隐藏微信右上角
	wx.ready(function() {
		wx.hideOptionMenu();

	});
 	$('.link').on('click',function(){
			var url = $(this).attr('link');
			if(!url) return false;
			location.href = url ;
		});
 	$("#apt").change(function(){
	var optionvalue=$(this).find("option:selected").text();	
	$(".stext").text(optionvalue);	
	});
	
	$('.buttom').click(function(){
	checksubmit();
	});



	function checksubmit() {
		var parm = {
                    name: $('#name').val(),
                    sex: $('.sex input:radio[name="sex"]:checked').val(),
                    email: $('#email').val(),
                    birth: $('#day').val(),
                    apt: $('#apt').val(),
                    num: $('#fanghao').val(),    
                };
      	//alert($('.sex input:radio[name="sex"]:checked').val());
		var url = "{:U('Gj/update')}";
         $.post(url, parm, function (obj) {
                    hint(obj.m);
                if(obj.s){setTimeout(function(){location.href="{:U('Gj/index')}"},3000)}
                }, 'json');
	}
</script>